function addTabs(name){
	var exist = $("#tabs").tabs("exists",name);
	
	if(!exist){
		$("#tabs").tabs("add",
				{
			iconCls:'icon-help',
			closable:true,
			title:name,
			content:'<iframe frameborder="0" width="100%" height="100%" src="http://www.baidu.com"></iframe>'
				});
	}else{
		$("#tabs").tabs("select",name);
	}
	
}
//使用标准json树
var setting1={
		callback:{
			onClick:onClick
		}
};
var zNodes=[
	           	{name:'节点1',children:[
	           	                      	{name:'节点11',children:[
	           	                      	                      {name:'节点111'},{name:'节点112'}
	           	                      						  ]},
	           	                      	{name:'节点12'}
	           	                      ]},
	           	{name:'节点2',page:'http://www.sohu.com'}
          ];

//初始化
$(function(){
	$.fn.zTree.init($("#tree1"),setting1,zNodes);
});

//使用简单json树
var setting2={
				data:{
					simpleData:{
						enable:true
					}
				},
				callback:{
					onClick:onClick
				}
			  };
var zNodes2=[
             {id:1,pId:0,name:'父节点1',open:true},
             {id:11,pId:1,name:'父节点11'},
             {id:111,pId:11,name:'叶子节点111'},
             {id:112,pId:11,name:'叶子节点112'},
             {id:113,pId:11,name:'叶子节点113',page:'http://www.sina.com'},
             ];
//初始化
$(function(){
	$.fn.zTree.init($("#tree2"),setting2,zNodes2);
});
function onClick(event,treeId,treeNode,clickFlag){
	alert(treeId);//代表的是id（tree1）tree2
//	alert(clickFlag);
	var page=treeNode.page;
	if(page!=undefined){
		var exist=$("#tabs").tabs("exists",treeNode.name);
		if(exist){
			$("#tabs").tabs("select",treeNode.name);
		}else{
			$("#tabs").tabs("add",{
				iconCls:'icon-help',
				title:treeNode.name,
				closable:true,
				content:'<iframe frameborder="0" width="100%" height="100%" src="'+page+'"></iframe>'
			});
		}
	}
}